package com.imooc.controller;

import com.imooc.pojo.User;
import com.imooc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by jiangfeixiang on 2018/3/27
 */
@RestController
@RequestMapping("user")
public class UserController {
    //自动导包
    @Autowired
    private UserService userService;

    /**
     * 查询
     */
    @RequestMapping("getList")
    public String getList(HttpServletRequest request){
        List<User> list = userService.getList();
        request.setAttribute("list",list);
        System.out.println(list);
        return "list";
    }
    /**
     * 测试首页
     */
    @RequestMapping("index")
    public String index(){
        return "index";
    }
}
